﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true"
    CodeFile="CreateUser.aspx.cs" Inherits="Users_CreateUser" Title="Нов потребител" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .style1
        {
            width: 345px;
            padding-top: 10px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h2 style="border-bottom: solid 1px black">
        <asp:Image ID="imgUsers" runat="server" Width="15" Height="15" ImageUrl="~/images/Profile.png" />&nbsp;&nbsp;Създаване
        на нов потребител</h2>
    <asp:UpdatePanel ID="upCreateUser" runat="server">
        <ContentTemplate>
            <asp:CreateUserWizard ID="cuwNewUser" runat="server" BorderStyle="Solid" BorderWidth="1px"
                CancelButtonText="Отказ" 
                CompleteSuccessText="Акаунтът е създаден успешно." ContinueButtonText="Продължи"
                CreateUserButtonText="Създай потребител" DuplicateEmailErrorMessage="E-mail адресът, който сте въвели, вече се използва. Моля въведете различен e-mail адрес."
                DuplicateUserNameErrorMessage="Моля въведете различно име на потребител." FinishPreviousButtonText="Предишна стъпка"
                InvalidEmailErrorMessage="Моля въведете валиден e-mail адрес." InvalidPasswordErrorMessage="Минимална дължина на паролата: {0}. Задължителни знаци различни от цифра или буква:  {1}."
                StartNextButtonText="Следваща стъпка" StepNextButtonText="Следваща стъпка" StepPreviousButtonText="Предишна стъпка"
                UnknownErrorMessage="Акаунтът не беше създаден. Моля опитайте отново." BorderColor="Black"
                FinishCompleteButtonText="Продължи" ContinueDestinationPageUrl="~/Users/EditUsers.aspx"
                DisableCreatedUser="True" OnNextButtonClick="cuwNewUser_NextButtonClick">
                <StepNavigationTemplate>
                    <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                        Text="Предишна стъпка" />
                    <asp:Button ID="StepNextButton" runat="server" ValidationGroup="cuwNewUser" CommandName="MoveNext"
                        Text="Следваща стъпка" />
                </StepNavigationTemplate>
                <StepStyle Width="350px" />
                <WizardSteps>
                    <asp:CreateUserWizardStep runat="server">
                        <ContentTemplate>
                            <table border="0" width="100%">
                                <tr>
                                    <td style="background-color: #d2f1ad; border-bottom: solid 1px black; padding-bottom: 10px"
                                        align="left" colspan="2">
                                        <h3>
                                            <label style="float: left">
                                                Акаунт информация</label>
                                            <label style="float: right;">
                                                1/3</label></h3>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="padding-top: 10px">
                                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Потребител:</asp:Label>
                                    </td>
                                    <td style="padding-top: 10px">
                                        <asp:TextBox ID="UserName" runat="server" MaxLength="256"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                            ErrorMessage="Потребителското име е задължително!" ToolTip="Потребителското име е задължително!"
                                            ValidationGroup="cuwNewUser">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Парола:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="Password" runat="server" TextMode="Password" MaxLength="128"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                            ErrorMessage="Паролата е задължителна!" ToolTip="Паролата е задължителна!" ValidationGroup="cuwNewUser">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Потвърди парола:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password" 
                                            MaxLength="128"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword"
                                            ErrorMessage="Моля потвърдете паролата!" ToolTip="Моля потвърдете паролата!"
                                            ValidationGroup="cuwNewUser">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="Email" runat="server" MaxLength="256"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
                                            ErrorMessage="E-mail адреса е задължителен!" ToolTip="E-mail адреса е задължителен!"
                                            ValidationGroup="cuwNewUser">*</asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2">
                                        <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"
                                            ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="&quot;Парола&quot; и &quot;Потвърди парола&quot; трябва да съвпадат."
                                            ValidationGroup="cuwNewUser"></asp:CompareValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2" style="color: Red;">
                                        <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:CreateUserWizardStep>
                    <asp:TemplatedWizardStep ID="twsRoleStep" runat="server" AllowReturn="true" Title="Role">
                        <ContentTemplate>
                            <table border="0">
                                <tr>
                                    <td style="background-color: #d2f1ad; border-bottom: solid 1px black; padding-bottom: 10px"
                                        align="left" colspan="2">
                                        <h3>
                                            <label style="float: left">
                                                Група на потребителя</label>
                                            <label style="float: right;">
                                                2/3</label></h3>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style1">
                                        <asp:CheckBoxList ID="ckblRoles" runat="server">
                                        </asp:CheckBoxList>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <CustomNavigationTemplate>
                            <table style="margin-bottom: 10px; margin-right: 10px">
                                <tr>
                                    <td>
                                        <asp:Button ID="StepNextButton" runat="server" ValidationGroup="cuwNewUser" CommandName="MoveNext"
                                            Text="Следваща стъпка" />
                                    </td>
                                </tr>
                            </table>
                        </CustomNavigationTemplate>
                    </asp:TemplatedWizardStep>
                    <asp:TemplatedWizardStep ID="twsProfileInfo" runat="server" AllowReturn="true" Title="ProfileInfo">
                        <ContentTemplate>
                            <table border="0" style="width: 100%">
                                <tr>
                                    <td style="background-color: #d2f1ad; border-bottom: solid 1px black; padding-bottom: 10px"
                                        align="left" colspan="3">
                                        <h3>
                                            <label style="float: left">
                                                Допълнителна информация</label>
                                            <label style="float: right;">
                                                3/3</label></h3>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblFirstName" runat="server">Име</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbFirstName" Width="260" runat="server" MaxLength="30"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ErrorMessage='Полето "Име" е задължително!'
                                                        ToolTip='Полето "Име" е задължително!' ValidationGroup="cuwNewUser" ControlToValidate="tbFirstName">*
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblMiddleName" runat="server">Презиме</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbMiddleName" Width="260" runat="server" MaxLength="30"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="tfvMiddleName" runat="server" ErrorMessage='Полето "Презиме" е задължително!'
                                                        ToolTip='Полето "Презиме" е задължително!' Display="Dynamic" ValidationGroup="cuwNewUser"
                                                        ControlToValidate="tbMiddleName">*
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblFamily" runat="server">Фамилия</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbFamily" Width="260" runat="server" MaxLength="30"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="rfvFamily" runat="server" ErrorMessage='Полето "Фамилия" е задължително!'
                                                        ToolTip='Полето "Фамилия" е задължително!' Display="Dynamic" ValidationGroup="cuwNewUser"
                                                        ControlToValidate="tbFamily">*
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblAge" runat="server">Възраст</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbAge" Width="30px" runat="server" MaxLength="2"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="rfvAge" runat="server" ErrorMessage='Полето "Възраст" е задължително!'
                                                        ToolTip='Полето "Възраст" е задължително!' ValidationGroup="cuwNewUser" Display="Dynamic"
                                                        ControlToValidate="tbAge">*
                                                    </asp:RequiredFieldValidator><asp:CompareValidator ID="rfvValidAge" runat="server"
                                                        Operator="GreaterThan" Type="Integer" ValueToCompare="15" Display="Dynamic" ValidationGroup="cuwNewUser"
                                                        ControlToValidate="tbAge" ToolTip="Минимална възраст - 15">*</asp:CompareValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblSex" runat="server">Пол</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:DropDownList ID="ddlSex" runat="server">
                                                        <asp:ListItem Text="Мъж" Value="Male"></asp:ListItem>
                                                        <asp:ListItem Text="Жена" Value="Female"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblAddress" runat="server">Адрес</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbAddress" Width="260" runat="server" MaxLength="80"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ErrorMessage='Полето "Адрес" е задължително!'
                                                        ToolTip='Полето "Адрес" е задължително!' Display="Dynamic" ValidationGroup="cuwNewUser"
                                                        ControlToValidate="tbAddress">*
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblPhone" runat="server">Телефон</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbPhone" Width="260" runat="server" MaxLength="25"></asp:TextBox>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="rfvPhone" runat="server" ErrorMessage='Полето "Телефон" е задължително!'
                                                        ToolTip='Полето "Телефон" е задължително!' Display="Dynamic" ValidationGroup="cuwNewUser"
                                                        ControlToValidate="tbPhone">*
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblMobilePhone" runat="server">Мобилен</asp:Label>
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="tbMobilePhone" Width="260" runat="server" MaxLength="25"></asp:TextBox>
                                                </td>
                                                <td>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <CustomNavigationTemplate>
                            <table style="margin-bottom: 10px; margin-right: 10px">
                                <tr>
                                    <td>
                                        <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                                            Text="Предишна стъпка" />
                                        <asp:Button ID="StepNextButton" runat="server" ValidationGroup="cuwNewUser" CommandName="MoveNext"
                                            Text="Следваща стъпка" />
                                    </td>
                                </tr>
                            </table>
                        </CustomNavigationTemplate>
                    </asp:TemplatedWizardStep>
                    <asp:CompleteWizardStep runat="server">
                        <ContentTemplate>
                            <table border="0" style="width: 100%">
                                <tr>
                                    <td style="background-color: #d2f1ad; border-bottom: solid 1px black; padding-bottom: 10px"
                                        align="left" colspan="2">
                                        <h3>
                                            <asp:Label ID="lblStatus" runat="server" Style="float: left">
                                        Статус</asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="padding: 20px;">
                                        <asp:Label ID="lblStatusInfo" runat="server">
                                Акаунтът е създаден успешно.
                                        </asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" colspan="2" style="width: 100%; padding-bottom: 10px; padding-right: 10px">
                                        <asp:Button ID="ContinueButton" runat="server" CausesValidation="False" CommandName="Continue"
                                            Text="Списък с потребители" ValidationGroup="cuwNewUser" />
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:CompleteWizardStep>
                </WizardSteps>
            </asp:CreateUserWizard>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
